package com.qph.app.system.service.impl;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.qph.app.system.dao.IPermDao;
import com.qph.app.system.service.IPermService;
import com.qph.base.security.entity.Permission;
import com.qph.base.service.impl.BaseServiceImpl;
import com.qph.utils.base.StringUtil;

/**
 * 权限资源管理
 * @author Administrator
 *
 */
public class PermServiceImpl extends BaseServiceImpl<Permission, IPermDao> implements
		IPermService {

	public List<Permission> getMenulList() {
		return dao.getMenulList();
	}


	@Transactional
	public int delete(String ids) {
		
		if (StringUtil.isEmpty(ids)){
			return 0; 
		}
		String[] idArr = ids.split(",");
		List<String> list = new ArrayList<String>(Arrays.asList(idArr));
		// 删除权限下用户
		dao.delPermUsers(list);
		//删除权限下角色
		dao.delPermRoles(list);
		return dao.batchDelete(list);
	}
}
